package com.distributeredis.redis_springboot.springboot_annotation_development.configuration_and_bean.Test;

import com.distributeredis.redis_springboot.springboot_annotation_development.configuration_and_bean.Pojo.UserPojo;
import com.distributeredis.redis_springboot.springboot_annotation_development.configuration_and_bean.config.MainConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestConfiguration {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfig.class);
        UserPojo userPojo = applicationContext.getBean(UserPojo.class);
        System.out.println(userPojo);
        // 容器中名字
        String[] forType = applicationContext.getBeanNamesForType(UserPojo.class);
        for (String name : forType) {
            System.out.println(name);
        }
        for (String definitionName : applicationContext.getBeanDefinitionNames()) {
            System.out.println(definitionName);
        }
    }
}
